import pyttsx3
# 初始化 pyttsx3 引擎
engine = pyttsx3.init()
# # 设置语音为中文
# voices = engine.getProperty('voices')
# for voice in voices:
#     if 'Chinese' in voice.languages or 'zh' in voice.languages:
#         engine.setProperty('voice', voice.id)
#         break
attribute = "你好，这是一个变量属性。"

# 使用 pyttsx3 播报变量属性
engine.say(attribute)
engine.runAndWait()